package com.qc31.comlib

import com.qc31.baselib.utils.MLog
import com.qc31.comlib.entity.Dictionary
import com.qc31.comlib.net.ServiceHelper

/** @Author Jasper @Time 2020/10/19 @Desc 提前请求处理类 */
object NetDataUtil {
    ///////////////////////////////////////////////////////////////////////////////////////////////////
    var colors: MutableList<Dictionary.PlateColor>? = null
    fun getColor() {
        ServiceHelper.getRepository().getDictionary("PLATE_COLOR").subscribe({
            colors = it.PLATE_COLOR
        }, {
            MLog.e("报错了" + it.message)
        })
    }

    fun getColorByName(name: String): String {
        colors?.forEach {
            if (it.name == name) return it.id
        }
        return ""
    }
}